#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

class Solution {
public:
    vector<string> findRelativeRanks(vector<int>& score) {
        int len = score.size();
        vector<string> ret(len, "0");
        
        for (int idx = 0; idx < len; idx++) {
            auto it = max_element(score.begin(), score.end());
            int pos = static_cast<int>(it - score.begin());
            GetScore(ret, pos, idx);
            score[pos] = -1;
        }

        return ret;
    }

    void GetScore(vector<string> &ret, int pos, int idx)
    {
        if (idx == 0) {
            ret[pos] = "Gold Medal";
        } else if (idx == 1) {
            ret[pos] = "Silver Medal";
        } else if (idx == 2) {
            ret[pos] = "Bronze Medal";
        } else {
            ret[pos] = to_string(idx + 1);
        }
    }
};

int main()
{
    Solution s;
    vector<int> score = {10,3,8,9,4};
    vector<string> ret = s.findRelativeRanks(score);

    for (auto ele : ret) {
        cout << ele << endl;
    }
    return 0;
}